﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using ClassLibrary.DAO;
using ClassLibrary.Entity;

public partial class Admin_UserControl_UcNon_warranty : System.Web.UI.UserControl
{
    TblJobsDAO jobDAO = new TblJobsDAO(Global.CONNECTION_STRING);

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadTuchCopy();
        }
    }

    private void LoadTuchCopy()
    {
        string id = Request.QueryString["id"];
        DataTable dt = jobDAO.reportJob1(Global.ConvertToInt(id));
        foreach (DataRow dr in dt.Rows)
        {
            lbJobNumber.Text = dr["JobID"].ToString();
            lbCustomerName.Text = dr["CustomerFullname"].ToString();
            lbManufactory.Text = dr["Manufacturer"].ToString();
            lbModel.Text = dr["Model"].ToString();
            lbIMEI.Text = dr["IMEINo"].ToString();
            lbNetwork.Text = dr["PhoneNetworkWith"].ToString();
            lbPass.Text = dr["LockPhone"].ToString();

            lbFail.Text = dr["FaultDescription"].ToString();
            lbAccessories.Text = dr["AccessoriesWithPhone"].ToString();
            lbInpection.Text = "";
            lbDateBook.Text = Convert.ToDateTime(dr["DateBook"].ToString()).ToString("dd/MM/yyyy");
            // lbBookBy.Text = dr["lbBookBy"].ToString();
            string idBookBy = dr["BookByID"].ToString();
            if (idBookBy == "1")
            {
                lbBookBy.Text = "Michael";

            }
            if (idBookBy == "2")
            {
                lbBookBy.Text = "Thao";
            }
            if (idBookBy == "3")
            {
                lbBookBy.Text = "Tung";
            }
            if (idBookBy == "4")
            {
                lbBookBy.Text = "Mi";
            }

            lbPhoneCotact.Text = dr["phonemobile"].ToString();

            lbHomePhone.Text = dr["phonehome"].ToString();

            lbWorkPhone.Text = dr["phonework"].ToString();


            lbEmail.Text = dr["emailaddress"].ToString();
        }

    }
}
